﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HPCERP.Model;

namespace HPCERP.SetupDatabase
{
    public static class TestCompany
    {
        public static Company GetObject()
        {
            var company = SelectTestCompany();
            if (company == null)
            {
                SetupTestCompany oSetup = new SetupTestCompany();
                oSetup.CreateCompany();
                company = SelectTestCompany();
            }
            return company;
        }


        private static Company SelectTestCompany()
        {
            hpc_erpEntities ctx = new hpc_erpEntities();

            return (from c in ctx.Company where c.Name == "Test Company" select c).FirstOrDefault();
        }
    }
}
